<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <%@include file="../common/include.jsp" %>
    <base href="<%=basePath%>">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" href="<%=path%>/favicon.ico" mce_href="<%=path%>/favicon.ico" type="image/x-icon">
    <link rel="shortcut icon" href="<%=path%>/favicon.ico" mce_href="<%=path%>/favicon.ico" type="image/x-icon">

    <title>流程管理系统 - 登录</title>


    <script language="JavaScript">

        /* 跳出iframe */
        if (window != top)
            top.location.href = location.href;


        // 响应回车键  页面绑定onkeydown事件

        document.onkeydown = keyListener;

        function keyListener(e) {

            e = e ? e : event;// 兼容FF

            if (e.keyCode == 13) {
                $("#submitBtn").click();
            }
        }


    </script>
</head>

<body class="gray-bg">

<div class="middle-box text-center loginscreen  animated fadeInDown">
    <div style="margin-top: 200px">
        <img src="h/img/logo.png" alt="">
        <form class="m-t" role="form" action="index.html">
            <div class="form-group">
                <input type="text" class="form-control" id="username" name="username" placeholder="用户名">
            </div>
            <div class="form-group">
                <input type="password" id="password" name="password" class="form-control" placeholder="密码">
            </div>
            <button type="button" id="submitBtn" class="btn btn-primary block full-width m-b">登 录</button>


            <%--<p class="text-muted text-center"><a href="login.html#">--%>
                <%--<small>忘记密码了？</small>--%>
            <%--</a> | <a href="register.html">注册一个新账号</a>--%>
            <%--</p>--%>

        </form>
    </div>
</div>


<!--统计代码，可删除-->
<script>


    $("#submitBtn").click(function () {
        $.ajax({
            type: 'POST',
            url: '${pageContext.request.contextPath}/doLogin.html',
            dataType: 'json',  //要求服务器返回 json对象 而不是字符串
            data: {
                "username": $("#username").val(),
                /*       "kaptcha": $("#kaptcha").val(), */
                "password": $("#password").val()

            },
            success: function (data) {


                if (data.code == 1) {
                    window.location.href = "${pageContext.request.contextPath}/main.html";
                    return;
                }
                else {

                    layer.msg(data.msg);
                    return;
                    //changePic();
                }


            },
            error: function () {
                alert("出错");
                //changePic();
            }

        })


    });

</script>
</body>
</html>
